﻿@if (this.User.Role >= UserRole.Moderator)
{
	<script type="text/javascript">
	    var editorOptions = [
						'source', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste',
                        'plainpaste',  '|', 'justifyleft', 'justifycenter', 'justifyright',
                        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                        'superscript', 'clearhtml', 'quickformat', 'selectall', '|',
                        'formatblock', 'fontname', 'fontsize', '/', 'forecolor', 'hilitecolor', 'bold',
                        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                        'insertfile', 'table', 'hr', 'emoticons',
                        'anchor', 'link', 'unlink', 
                        ];
	</script>
}
else 
{
	<script type="text/javascript">
	    var editorOptions = [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link', 'multiimage'
                        ];
	</script>
}

@Html.Script("~/scripts/Libs/kindleditor/kindeditor.js")
@Html.Script("~/scripts/Libs/kindleditor/lang/zh_CN.js")
@Html.Script("~/scripts/Libs/kindleditor/plugins/code/prettify.js")
@Html.Stylesheet("~/scripts/Libs/kindleditor/themes/default/default.css")
@Html.Stylesheet("~/scripts/Libs/kindleditor/plugins/code/prettify.css")

<script type="text/javascript">
    $(document).ready(function () {
        KindEditor.ready(function (K) {
            var editor1 = K.create('#descriptionT', {
                width: '95%',
                height: '180px',
                cssPath: AC_ROOT_DIR + '/scripts/Libs/kindleditor/plugins/code/prettify.css',
                uploadJson: AC_ROOT_DIR + '/topic/upload',
                //                fileManagerJson: AC_ROOT_DIR + '/admin/forums/GetTopicType?forumID=1',
                allowFileManager: true,
                items: editorOptions,
                afterCreate: function () {
                    var self = this;
                    K.ctrl(document, 13, function () {
                        self.sync();
                        K('form[id=topicEditForm]')[0].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function () {
                        self.sync();
                        K('form[id=topicEditForm]')[0].submit();
                    });
                }
            });
            prettyPrint();
        });
    });
</script>